// Problem: 
// Contest: 
// URL: 
// Memory Limit: 
// Time Limit: 
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s*w;
}

signed main()
{
	list<int> l1;
	list<int> l2;
	int n;
	while(cin>>n)
	{
		l1.push_back(n);
		if (getchar() == 10)
			break;
	}
	l1.push_back(n);
	while(cin>>n)
	{
		l2.push_back(n);
		if (getchar() == 10)
			break;
	}
	l2.push_back(n);
	auto it1=l1.begin();
	auto it2=l2.begin();
	list<int> l3;
	while(it1!=l1.end()&&it2!=l2.end())
	{
		if(*it1<*it2)
		{
			if(*it1==l3.back())
			{
				it1++;
				continue;
			}
			l3.push_back(*it1);
			it1++;
		}
		else
		{
			if(*it2==l3.back())
			{
				it2++;
				continue;
			}
			l3.push_back(*it2);
			it2++;
		}
	}
	while(it1!=l1.end())
	{
		if(*it1==l3.back())
		{
			it1++;
			continue;
		}
		l3.push_back(*it1);
		it1++;
	}
	while(it2!=l2.end())
	{
		if(*it2==l3.back())
		{
			it2++;
			continue;
		}
		l3.push_back(*it2);
		it2++;
	}
	for(auto e : l3)cout<<e<<" ";
	return 0;
}
